int sumOddLengthSubarrays(int* arr, int arrSize){
    int res = 0;
    int lEven,lOdd,rEven,rOdd;
    for(int i=0;i<arrSize;i++){
        lOdd = (i+1)/2;
        lEven = i/2 + 1;
        rOdd = (arrSize-i)/2;
        rEven = (arrSize-i+1)/2;
        res += (lOdd*rOdd + lEven*rEven) * arr[i];
    }
    return res;
}

